import {Component} from '@angular/core';
import { TranslateService } from '../../translate';
@Component({
	selector:'translate-menu',
	template:`
		<a href="javascript:;" (click)="langChange(lang)" matTooltip="Languages">{{lang=='zh-cn'?'English':'中文'}}</a>
	`
})

export class TranslateMenu{

	constructor(private _translateService:TranslateService){}


	// 中英文切花
  lang: string = this._translateService.getLang();

  langChange(_lang) {
    if (_lang === 'zh-cn') {
      this.lang = 'en';

      this._translateService.use('en');

    } else {
      this.lang = 'zh-cn';
      this._translateService.use('zh-cn');
    }

  }
}